/**
 * Chinapnr.com Inc.
 * Copyright (c) 2004-2012 All Rights Reserved.
 */

package com.zx.screener.web;

import com.zx.screener.service.userCenter.model.LoginInfo;
import com.zx.screener.service.userCenter.service.LoginService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zx.screener.service.userCenter.exception.UserCenterServiceException;

@Controller
@RequestMapping("/screener")
public class LoginController {
    private LoginService        loginService;

    /**
     * 登录
     */
    @RequestMapping("/doLogin")
    public String doLogin(ModelMap model,LoginInfo loginInfo){
        try{
            loginService.Login(loginInfo.getLoginId(),loginInfo.getPassword());
        }catch(UserCenterServiceException use){
            model.put("errorMsg",use.getMessage());
            return "500err";
        }catch(Exception e){
            model.put("errorMsg","系统繁忙");
            return "500err";
        }
        return "index";
    }
    
    /**
     * 登出
     */
    @RequestMapping("/doLogout")
    public String doLogout(ModelMap model){
        return "login";
    }
}
